package com.personalforumapi.controller;

import com.personalforumapi.entity.user;
import com.personalforumapi.repository.userRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * @Author:kinjaze
 * @Date:2020/9/15 11:10
 */

@RestController
@RequestMapping("/user")
public class userController {
    @Autowired
    private userRepository userRepository;

    @GetMapping("/login")
    public List<user> findAll(){
        return  userRepository.findAll();
    }
    @PostMapping("/register")
    public void register(@RequestBody user user){
        userRepository.save(user);
    }
}
